package com.qf.dao.impl;

import com.qf.dao.UserDao;
import com.qf.entity.User;
import com.qf.util.DBUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import java.sql.SQLException;

public class UserDaoImpl implements UserDao {

    private QueryRunner runner=new QueryRunner(DBUtil.getDateSource());

    public User selectUser(String uname, String pwd) {
        String sql="select * from t_user where name=? and passwords=?";
        try {
            return runner.query(sql,new BeanHandler<>(User.class),uname,pwd);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
